

def dp_data(file_name,is_train):
    days_df = pd.read_csv('input/'+str(file_name))[['date', 'code', 'open', 'close', 'high', 'low', 
                                                    'quote_rate','high_limit', 'turnover', 't_rate', 'xl', 'xl_rate']]
        
    execfile('v4/raise.py')
    raiseF = RaiseF()
    raise_df = raiseF.mark_raise(days_df)
    
    execfile('v4/ma.py')
    maF = MaF()
    ma_df = maF.mark_ma_d(days_df)
    
    execfile('v4/high.py')
    highF = HighF()
    high_df = highF.mark_h_d(days_df)
    
    execfile('v4/xl.py')
    xlF = XlF()
    xl_df = xlF.mark_xl(days_df)
    xl2_df = xlF.mark_xl_col_growth(days_df,'xl')
    
    execfile('v4/turnover.py')
    turnoverF = TurnoverF()
    turnover_df = turnoverF.mark_col_growth(days_df,'turnover')
    turnover2_df = turnoverF.mark_vol_turnover(days_df)


    final_days_df = days_df[['date', 'code', 'open', 'close', 'high', 'low', 'quote_rate','turnover', 't_rate','xl', 'xl_rate' ]]
    final_days_df['float_mv'] = final_days_df['turnover']*100/final_days_df['t_rate']
    dfs = [final_days_df,high_df,raise_df,ma_df, xl_df,xl2_df,turnover_df,turnover2_df]
    all_feature_df = merge_all_df(dfs)
    

    execfile('v4/raise_score.py')
    raise_scoreF = RaiseScoreF()
    all_feature_df = raise_scoreF.mark_vol_raise_score(all_feature_df)
    print(len(all_feature_df))
    p_col_len(all_feature_df)

    if is_train:
        execfile('v4/label.py')
        labelF = LabelF()
        label_df = labelF.mark_label(days_df)
        all_feature_df = pd.merge(all_feature_df,label_df,on=['date','code'])
        all_feature_df.to_csv('output/v4_train.csv',index=False,encoding='utf-8')
    else:
        all_feature_df.to_csv('output/v4_predict.csv',index=False,encoding='utf-8')


    
